/**
 * Created by dywu on 2015/9/24.
 */
angular.module('app.service.auth', [
    'ngResource'
])

//登陆服务
    .service('LoginService', ['$resource', function($resource) {
        this.login = function (manager,success,error) {
            var resource = $resource(authurl + "user/login");
            return resource.save(manager,success,error);
            // var deferred = $q.defer();
            // $http({
            //     method: 'POST',
            //     url: authurl + "manager/login",
            //     data: manager
            // }).success(function (data, status, headers, config) {
            //     deferred.resolve(data);
            // }).error(function (data, status, headers, config) {
            //     deferred.reject(data);
            // });
            // return deferred.promise;
        };
        this.getbyuserid = function (id,success,error) {
            var resource = $resource(localhost + "shops/byuser/:id");
            return resource.query({id:id},success,error);
        };
    }])
;